﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using BackupObjects;

namespace BackupWebRole.Controllers
{

    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            

            if (User != null && User.Identity != null && !string.IsNullOrEmpty(User.Identity.Name))
            {
                return RedirectToAction("Index", new { controller = "Backup", Area = "Backup" });
            }
            
            ViewData["Message"] = "Welcome to your personal Azure backup.";
            if(Membership.ValidateUser(BackupRepository.UserNameAdmin,BackupRepository.UserNameAdmin))
            {
                ViewData["Message"] += string.Format("The password for {0} is still {0}. Change your admin password",BackupRepository.UserNameAdmin);
            }
            
            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
